/*主页的更多商品*/
import { } from "https://cdn.bootcdn.net/ajax/libs/jquery/1.12.4/jquery.js";
// .html(data);
$.ajax({
    url: "http://10.31.165.61/JS2012/mall360/php/moreitem.php",
    dataType: "json"
}).done(function (data) {
    if (data.length >= 40) {
        // 只显示40条数据
        data.length = 40;
        let $strHtml = "";
        $.each(data, function (index, value) {
            $strHtml += `
                <li>
                    <a href="http://10.31.165.61//JS2012/mall360/src/detail.html?sid=${value.sid}">
                        <div><img class='lazy' data-original="${value.picurl}" alt="" width="180" height="180"></div>
                        <p class="item_title">${value.title}</p>
                        <span class="item_price">￥${value.price}</span>
                    </a>
                </li>
            `
        });
        $(".more_item ul").html($strHtml);

        //懒加载
        $("img.lazy").lazyload({
            effect: "fadeIn" //切换形式
        });
    }
});